import { ImageResponse } from 'next/og'; import { Wallpaper } from '@/components/brand/og'; import { TODAY_LABELS } from '@/components/changes/today-sections'; import { apiD3, safe } from '@/lib/api'; import { fmtDate, fmtInt, num } from '@/lib/format'; import { SITE_NAME } from '@/lib/site'; export const runtime = 'nodejs'; export const alt = `Today in AI on ${SITE_NAME}`; export const size = { width: 1200, height: 630 }; export const contentType = 'image/png'; /** OG image for /changes/[date]: the day and its live section counts. */ export default async function DailyOgImage({ params }: { params: Promise<{ date: string }> }) { const { date } = await params; const ok = /^\d{4}-\d{2}-\d{2}$/.test(date); const d = ok ? await safe(apiD3.changesDaily(date, 1)) : null; const sections = (d?.today ?? []).filter((s) => (num(s.total) ?? 0) > 0).slice(0, 4); const counters: [string, string][] = d ? [['Events', fmtInt(d.total)], ...sections.map((s) => [s.label ?? TODAY_LABELS[s.key] ?? s.key, fmtInt(s.total)] as [string, string])] : []; return new ImageResponse(, { ...size }); }